<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
	<style>
		#box{
			width:200px; height:200px; background:red;
		}
	</style>
 </head>
 <body>
		<div id="box"></div>
 </body>
</html>
<script>
	//获取元素
	var oBox = document.getElementById('box');

	//默认为红色，点击一次变黄，再点击变红.....
	//直接改变


	//点击事件
	var count = 0; //信号量

	oBox.onclick = function(){
		//在这个里面要去切换颜色
		count++;
		console.log(count);
		//判断这个信号量只有两情况下：奇偶性
		if(count % 2 == 0){
			oBox.style.background = 'red';
		}else{
			oBox.style.background = 'yellow';
		}

		
		
		
	}
</script>
